package ch.bfh.abhmcm.SoftwareEngineeringAndDesign.controller.historyRFC;

import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.controller.database.DatabaseConnection;
import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.model.History;

public class AddHistoryinDBThread extends Thread {

	private String description, userFullName,source;



	public AddHistoryinDBThread( String userFullName,
			String source, String description) {
		this.description = description;
		this.userFullName = userFullName;
		this.source = source;
	}

	@Override
	public void run() {

		DatabaseConnection connection = new DatabaseConnection();
		connection.connect();

		String query = "INSERT INTO "+ History.TABLENAME+" ("+
		History.TC_USER+", "+
		History.TC_SOURCE+", "+
		History.TC_DESCRIPTION+") VALUES ('"+
		this.userFullName+"', '"+
		this.source+"', '"+
		this.description+"')";
			
		try {
			connection.insertquery(query);
		} catch (Exception e) {
			System.out.println("history error");
		}
		
		connection.disconnect();
	}

}
